package com.zatech.cgnci.project.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
@ApiModel("分入结算DTO")
public class CgnciClaimSettlementTaskDTO {

    @ApiModelProperty("结算ID(修改时必填)")
    private Long settlementId;

    @ApiModelProperty("案件ID")
    private Long caseId;

    @ApiModelProperty("任务号")
    private String taskNo;

    @ApiModelProperty("结算类型(PREPAYMENT-预付结算 FINAL-结案结算)")

    private String settlementType;

    @ApiModelProperty("汇率约定方式(BY_VALUE-按数值 BY_DATE-按日期)")
    @NotNull(message = "汇率约定方式不能为空")
    private String rateType;

    @ApiModelProperty("汇率日期")
    private Date rateDate;

    @ApiModelProperty("汇率")
    @NotNull(message = "汇率不能为空")
    @DecimalMin(value = "0", message = "汇率不能为负数")
    private BigDecimal rate;

    @ApiModelProperty("备注")
    private String remarks;

    @ApiModelProperty("再保人列表")
    @Valid
    @NotNull(message = "再保人不能为空")
    private List<ReinsurerDTO> reinsurers;

    @Data
    public static class ReinsurerDTO {
        @ApiModelProperty("再保人类型(CEDING-分出人 ACCEPTOR-接受人)")
        @NotNull(message = "再保人类型不能为空")
        private String reinsurerType;

        @ApiModelProperty("再保人名称")
        @NotNull(message = "再保人名称不能为空")
        private String reinsurerName;

        @ApiModelProperty("再保人档案号")
        @NotNull(message = "再保人档案号不能为空")
        private String reinsurerRef;

        @ApiModelProperty("层号")
        private String layerNo;

        @ApiModelProperty("层名称")
        private String layerName;

        @ApiModelProperty("结算币种")
        @NotNull(message = "结算币种不能为空")
        private String settlementCurrency;

        @ApiModelProperty("原始币种")
        @NotNull(message = "原始币种不能为空")
        private String originalCurrency;

        @ApiModelProperty("结算明细")
        @Valid
        @NotNull(message = "结算明细不能为空")
        private List<DetailDTO> details;
    }

    @Data
    public static class DetailDTO {
        @ApiModelProperty("明细类型(INWARD-分入结算 RECOVERY-转分摊回)")
        @NotNull(message = "明细类型不能为空")
        private String detailType;

        @ApiModelProperty("险种")
        @NotNull(message = "险种不能为空")
        private String riskType;

        @ApiModelProperty("标的名称")
        private String subjectName;

        @ApiModelProperty("金额类型")
        @NotNull(message = "金额类型不能为空")
        private String amountType;

        @ApiModelProperty("结算金额(结算币种)")
        @NotNull(message = "结算金额不能为空")
        @DecimalMin(value = "0", message = "结算金额不能为负数")
        private BigDecimal settlementAmount;
    }
} 